<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<link href="<c:url value='/css/draw.css'/>" rel="stylesheet">
<link href="<c:url value='/css/easyui.css'/>" rel="stylesheet">
<link href="<c:url value='/css/icon.css'/>" rel="stylesheet">
<script src="<c:url value='/js/jquery.min.js'/>"></script>
<script type="text/javascript"
	src="<c:url value='/js/jquery.easyui.min.js'/>"></script>
<div class="page-header" style="width: 80%">
	<h3 style="margin-top: auto">功能函数组件详细信息</h3>
</div>
<c:set var="muri" value="${fn:replace(item.uri,':', '/')}" />
<div class="row-fluid">
	<div>
		<table class="table table-hover" style="width: 80%">
			<thead>
				<tr>
					<th style="width: 20%">属性</th>
					<th style="width: 80%">详细信息</th>
				</tr>
			</thead>
			<tbody>
				<tr>
					<td>名称</td>
					<td><c:out value="${item.name}" /></td>
				</tr>

				<c:choose>
					<c:when test="${!empty item.cinterface}">
						<tr>
							<td>实现接口</td>
							<td><a href="<%=request.getContextPath()%>//${item.cinterface.uri.replace(':', '/')}"+><c:out value="${item.cinterface.name}" /></a></td>
						</tr>
					</c:when>
				</c:choose>
				<tr>
					<td>创建时间</td>
					<td><c:out value="${item.createTime.getYear()+1900}" />-<c:out
							value="${item.createTime.getMonth()+1}" />-<c:out
							value="${item.createTime.getDate()}" /></td>
				</tr>
				<tr>
					<td>最近修改时间</td>
					<td><c:out value="${item.lastModified.getYear()+1900}" />-<c:out
							value="${item.lastModified.getMonth()+1}" />-<c:out
							value="${item.lastModified.getDate()}" /></td>
				</tr>
				<tr>
					<td>版本</td>
					<td><c:out value="${item.version}" /></td>
				</tr>
				<tr>
					<td>创建者</td>
					<td><c:out value="${item.owner.username}" /></td>
				</tr>
				<tr>
					<td>描述信息</td>
					<td><c:out value="${item.description}" /></td>
				</tr>
				<c:choose>
					<c:when test="${(!empty item.implement) and (item.implement !='')}">
						<tr>
							<td>代码实现</td>
							<td><pre class="pre-scrollable"><c:out value="${item.implement}" /></pre></td>
						</tr>
					</c:when>
				</c:choose>
				<c:if test="${(!empty headerFiles) ||(!empty headerFiles)}">
					<tr>
						<td>上传的代码文件</td>
						<td>
							<c:if test="${!empty headerFiles}">
								<p>头文件(.h)：</p>
								<c:forEach items="${headerFiles}" var="file">
									<p><c:out value="${file}" /></p>
								</c:forEach>
							</c:if>
							<c:if test="${!empty srcFiles}">
								<p>源文件(.c)：</p>
								<c:forEach items="${srcFiles}" var="file">
									<p><c:out value="${file}" /></p>
								</c:forEach>
							</c:if>
						</td>
					</tr>
				</c:if>
				<tr>
					<td>依赖项</td>
					<td><c:choose>
							<c:when test="${!empty item.depends}">
								<c:forEach items="${item.depends}" var="list" varStatus="s">
									<c:set var="muri" value="${fn:replace(list.uri,':', '/')}" />
									<a rel="tooltip" href="<%=request.getContextPath()%>/${muri}" data-toggle="tooltip" data-placement="top" title="${list.description}"><c:out value="${list.name}" /></a>
									<br />
								</c:forEach>
							</c:when>
						</c:choose></td>
				</tr>
				<tr>
					<td>操作</td>
					<td><div class="btn-group">
							<button class="btn" onclick="window.location.href='<%=request.getContextPath()%>/${muri}/update';"><i class="icon-edit"></i>&nbsp;编辑</button>
							<button class="btn"  onclick="javascript:$('#myModal').dialog('open')"><i class="icon-trash"></i>&nbsp;删除</button>
							<button class="btn"
								onclick="window.location.href='<%=request.getContextPath()%>/${muri}/download';"><i class="icon-download"></i>&nbsp;下载</button>
						</div></td>
				</tr>
				<c:choose>
					<c:when test="${!empty item.cinterface}">
						<tr class="info">
							<td colspan="2" align="center"><center>
									<strong>实现接口详细信息</strong>
								</center></td>
						</tr>


						<tr>
							<td>名称</td>
							<td><c:out value="${item.cinterface.name}" /></td>
						</tr>
						<tr>
							<td>描述</td>
							<td><c:out value="${item.cinterface.description}" /></td>
						</tr>
						<tr>
							<td>函数</td>
							<td><c:choose>
									<c:when test="${!empty item.cinterface.interfaceMethods}">
										<c:forEach items="${item.cinterface.interfaceMethods}"
											var="method" varStatus="s">
											<c:out value="${method.methodSigniture}" />
											<br />
										</c:forEach>
									</c:when>
								</c:choose></td>
						</tr>
					</c:when>
				</c:choose>
			</tbody>
			<tfoot>
			</tfoot>
		</table>
	</div>
</div>
<!--/row-->
<!--/row-->
<div id="myModal" class="easyui-dialog" title="删除功能函数组件"
							style="width: 400px; height: auto; padding: 10px" closed="true"
							data-options="iconCls: 'icon-remove-dialog'" buttons="#dlg-buttons">
							<div>
								<p>确定删除该功能函数组件吗？</p>
							</div>
						</div>
						<div id="dlg-buttons" style="float: right;">
							<a href="<%=request.getContextPath()%>/${muri}/delete" class="easyui-linkbutton"
								iconCls="icon-ok-dialog" onclick="dlgOK()">确定</a> <a
								href="javascript:void(0)"
								class="easyui-linkbutton" iconCls="icon-cancel-dialog"
								onclick="dlgCancel()">取消</a>
						</div> <script type="text/javascript">
			$(function() {
				$('#myModal').dialog('close');
			});
			function dlgOK(){
				$('#myModal').dialog('close');
			}
			function dlgCancel(){
				$('#myModal').dialog('close');
			}
	</script>